<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="320">
<title>Hello H5+</title>
<link rel="stylesheet" type="text/css" href="res/doc.css" charset="utf-8">
<link rel="stylesheet" type="text/css" href="res/prettify.sons.css" charset="utf-8">
<script type="text/javascript" src="res/doc.js" charset="utf-8"></script><script type="text/javascript" src="res/prettify.js" charset="utf-8"></script>
</head>
<body><div id="content" class="content">
<h1><a name="plus.proximity">proximity</a></h1>
<p>Proximity模块管理设备距离传感器，可获取当前设备的接近距离信息，通过plus.proximity可获取设备距离传感管理对象。</p>
<h2>方法：</h2>
<ul>
<li>
<a href="#plus.proximity.getCurrentProximity">getCurrentProximity</a>: 获取当前设备的接近距离信息</li>
<li>
<a href="#plus.proximity.watchProximity">watchProximity</a>: 监听设备接近距离的变化</li>
<li>
<a href="#plus.proximity.clearWatch">clearWatch</a>: 关闭监听设备接近距离变化</li>
</ul>
<h2>回调方法：</h2>
<ul>
<li>
<a href="#plus.proximity.ProximitySuccessCallback">ProximitySuccessCallback</a>: 获取设备接近距离信息成功的回调函数</li>
<li>
<a href="#plus.proximity.ProximityErrorCallback">ProximityErrorCallback</a>: 获取设备接近距离信息失败的回调函数</li>
</ul>
<h2>权限：</h2>
<p>5+功能模块（permissions）</p>
<pre class="prettyprint linenums">
{
// ...
"permissions":{
	// ...
	"Proximity": {
		"description": "距离感应器"
	}
}
}
			</pre>
<h1><a name="plus.proximity.ProximitySuccessCallback">ProximitySuccessCallback</a></h1>
<p>获取设备接近距离信息成功的回调函数</p>
<pre class="prettyprint linenums">
void onSuccess( distance ) {
	// Get distance success code.
}
				</pre>
<h2>参数：</h2>
<ul><li>distance: 
		<em>(
			<font class="type">Number</font>
			)
			必选 </em>设备接近距离<br>设备接近距离传感器获取的距离值，单位为厘米。如果感应器无法获取准确的距离值，则在接近设备时返回0，否则返回Infinity。</li></ul>
<h2>返回值：</h2>
<font class="type">void</font>
			: 无<h1><a name="plus.proximity.ProximityErrorCallback">ProximityErrorCallback</a></h1>
<p>获取设备接近距离信息失败的回调函数</p>
<pre class="prettyprint linenums">
void onError( error ) {
	// Get distance error code.
}
				</pre>
<h2>参数：</h2>
<ul><li>error: 
		<em>(
			<font class="type">DOMException</font>
			)
			必选 </em>失败信息<br>
</li></ul>
<h2>返回值：</h2>
<font class="type">void</font>
			: 无<br><br>
</div></body>
</html>
